package com.smartlifev30.baiwei.activity;

import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;

import com.smartlifev30.R;
import com.smartlifev30.baiwei.adapter.ControlFragmentAdapter;
import com.smartlifev30.baiwei.bean.ControlPage;
import com.smartlifev30.baiwei.fragment.ControlRoomFragment;
import com.smartlifev30.mvp.presenter.BasePresenter;

import java.util.ArrayList;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * @author tys
 */
public class ControlActivity extends BaseActivity {

    @BindView(R.id.con_tab_layout)
    TabLayout tabLayout;

    @BindView(R.id.con_view_pager)
    ViewPager viewPager;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_control);
        ButterKnife.bind(this);
        initView();
    }

    private void initView() {
        ArrayList<ControlPage> data = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            ControlPage controlPage = new ControlPage(ControlRoomFragment.newInstance("1", "22"),
                    "房间" + i);
            data.add(controlPage);
        }
        viewPager.setAdapter(new ControlFragmentAdapter(getSupportFragmentManager(), data));
        tabLayout.setupWithViewPager(viewPager);
    }

    @Override
    protected BasePresenter createPresent() {
        return null;
    }



    @OnClick(R.id.title_back)
    void onBack(){
        onBackPressed();
    }
}
